<?php

namespace app\index\service;

use app\index\model\Reflect as ReflectModel;

class Reflect
{

    public static function getTodayNum($user_id)
    {
        $reflect_model = ReflectModel::whereTIme('create_time', 'today')
                ->where('member_id', $user_id)
                ->find();
        if (empty($reflect_model))
        {
            $reflect_one_arr = [
                'member_id' => $user_id,
                'count' => 0,
            ];
            ReflectModel::create($reflect_one_arr);
            return $reflect_one_arr['count'];
        }
        else
        {
           return $reflect_model->count;
        }
    }

}
